﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Control="clr-namespace:WPFDataEditors.ProgressBar.Control"
                    xmlns:Converter="clr-namespace:WPFDataEditors.ProgressBar.Converter">
    <Converter:ProgressBarContentConverter x:Key="ProgressBarContentConverter"/>
    <Style TargetType="{x:Type Control:ProgressBar}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Control:ProgressBar}">
                    <Grid>
                        <ProgressBar Value="{TemplateBinding Value}" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}"></ProgressBar>
                            <Viewbox>
                            <TextBlock DataContext="{Binding RelativeSource={RelativeSource AncestorType=Control:ProgressBar},Path=DataContext}" Tag="{TemplateBinding ProgressBarType}" TextAlignment="Center" Background="Transparent" FontFamily="Times" Foreground="Black" x:Name="ProgressText" Margin="2,2,2,2" >
                                <TextBlock.Text>
                                    <MultiBinding Converter="{StaticResource ProgressBarContentConverter}">
                                         <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Maximum"/>
                                          <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Value"/>
                                          <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content"/>
                                          <Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="ProgressBarType"/>
                                     </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>
                        </Viewbox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>